home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Utils□□□ Divers 2 / ResCompare 2.6 folder / Documentation / About Patches next >
Text File  |  1996-03-06  |  14KB  |  269 lines

  1. About Patches╔
  2.  
  3. ResCompare can create a self╨applying patch application. That╒s a tiny application that can change an old version of a file into a newer version. You can use the patch to distribute upgrades of your software without sending a new copy of the entire application. Patches contain only the differences between versions, and are typically 40% of the original file, so you can save disk space and communications upload/download time by sending the patch instead of the entire application. Also, the patch is only useful to owners of the original version, so you can distribute patches to your commercial software over public bulletin boards.
  4.  
  5. How to Apply a Patch
  6. Patches are easy to apply. Just open a self╨applying patch and it displays some notes.
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. It then prompts you for the file to patch. Depending on how it was configured, the patch may also ask you where to save the new version.
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. A bar graph displays the progress.
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. When done, it tells you if it was successful.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. It╒s that simple╤a true no╨brainer.
  71.  
  72. Creating Self╨Applying Patches
  73. Self╨applying patches are created with ResCompare╒s Make Patch command. After comparing the old file to the new file, select the resources that you want included in the patch and choose Make Patch from the Change menu.
  74.  
  75. Note that you needn╒t patch all the changed resources. Perhaps your application writes personalization data into itself; ResCompare lets you choose not to update those resources, by selecting only the ones you want the patch to change.
  76.  
  77. ResCompare asks if you want to create a new patch or append to an existing patch.
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. If you╒re making a new patch, click New. A second dialog lets you set various patch options.
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Ñ    You can choose the prompt that the patch will use when asking for the original file. By default, the prompt will be ╥Where is <original-file>?╙, where the name of your master file is used for <original-file>.
  112.  
  113. Ñ You have several choices for the dispositions of the master (original) file and the update (patched) file. That is, what the patch should do with these files after patching. Some combinations of options are not allowed because they are nonsensical.
  114.  
  115. With certain master file dispositions, you have the option of renaming the master file as it is moved about. You can provide a template file name to which the patch will attempt to rename the master file. Within the template, the substitution strings ^FILE and ^VERS will be changed by the patch to the chosen file╒s actual name and version, respectively.
  116.  
  117. The following table outlines the various choices, and under what circumstances you might need to use them.
  118.  
  119.      Master     Update     Effect
  120.       Leave        Save as     Master file left as-is; user prompted to save update file.
  121.                                        Safest choice, and thus the default. However, if the user chooses
  122.                                        to replace the master file, the dispositions change to
  123.                                        ╥Master: Delete; Update: Replace╙, which is the least safe choice.
  124.                                        But that╒s OK, because the user confirmed the ╥replace existing?╙
  125.                                        alert.
  126.       LeaveRename  Save as     Master file renamed; user prompted to save update file.
  127.        Leave        Exchange     Illegal; you can╒t leave the master file alone and exchange it
  128.                                        with the update file.
  129.       LeaveRename  Exchange    Master and update files exchanged; master file moved and
  130.                                renamed.
  131.                                        A good way to update an open file, but only if the file╒s location
  132.                                        is not significant. Using this for an extension in the Extensions
  133.                                        folder would not be a good idea, as it would leave the renamed
  134.                                        master file in the Extensions folder.
  135.       Leave        Replace      Illegal; you can╒t leave the master file alone and replace it.
  136.       LeaveRename  Replace     Master file moved and renamed; update file moved and
  137.                                renamed to master location from temporary items folder.
  138.       ___________________________________________________________________________________
  139.       Trash        Save as     Master file moved to trash; user prompted to save update
  140.                                file.
  141.       TrashRename  Save as     Master file moved and renamed to trash; user prompted to
  142.                                save update file.
  143.       Trash        Exchange    Master and update files exchanged; master file moved to
  144.                                trash.
  145.                                        Good for updating open files where you want to preserve the
  146.                                        file ID.
  147.       TrashRename  Exchange    Master and update files exchanged; master file moved and
  148.                                renamed to trash.
  149.                                        Better for updating open files where you want to preserve the
  150.                                        file ID.
  151.       Trash        Replace     Master file moved to trash; update file moved and renamed
  152.                                to master location from temporary items folder.
  153.       TrashRename  Replace     Master file moved and renamed to trash; update file moved
  154.                                and renamed to master location from temporary items
  155.                                folder.
  156.       ___________________________________________________________________________________
  157.       Delete       Save as     Master file deleted; user prompted to save update file.
  158.       Delete       Exchange    Master and update files exchanged; master file deleted.
  159.       Delete       Replace     Master file deleted; update file moved and renamed to
  160.                                master location from temporary items folder.
  161.                                        These three are the least safe choices, in my opinion.
  162.  
  163.  
  164. Ñ The box labeled ╥Smart-Installed Application╙ should normally be left unchecked. However, if you are creating a patch for an application that can be installed by the user as either a 68K-only, PPC-only, or ╥fat╙ variant of itself, you should check this box. When checked, ResCompare automatically sets a flag on each resource from a select group that may or may not be present in each of the three variants. The flag (needNotVerify, see the document ╥Patch File Format╙) tells the patch to only apply its updates in the presence of the resource, and not to complain if the resource doesn╒t exist.
  165.  
  166.  
  167. When you click OK, ResCompare asks you to save the patch.
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186. Here, you may choose the language that the user interface of the patch application should use. Currently, the following languages are available.
  187.  
  188.    Ñ German (courtesy of Frank Nieºen)
  189.    Ñ Italian (courtesy of Dario Accornero)
  190.    Ñ Swedish (courtesy of RenÄ Hedemyr)
  191.    Ñ Danish (courtesy of J┐rgen M╛llinger)
  192.    Ñ Japanese (courtesy of Masatsugu Nagata)
  193.    Ñ Russian (courtesy of Slava Karpenko)
  194.  
  195. These translations were contributed by the persons noted above, and more are becoming available all the time. If you would like to translate a patch to another language, see the section ╥Translating Patch for a Foreign Language,╙ below, for instructions.
  196.  
  197. ResCompare then finds the differences between the selected resources and saves them in the self╨applying patch.
  198.  
  199. One Patch for Many Versions
  200. If you have released several versions of your application, you can create a patch that will work with all released versions. This is done by appending additional patches to an existing one. I╒ll go through an example that describes the process. Let╒s say you have three released versions of your application named Sample: version 1.0, version 1.0.1 and version 1.2. You want to release version 1.3 as a self╨applying patch that will upgrade all existing versions.
  201.  
  202. Ñ    Create the new patch ╥Sample 1.3 patch,╙ as described above, that patches version 1.0 to 1.0.1.
  203.  
  204. Ñ    Using ResCompare, compare version 1.0.1 to version 1.2. Select the changed resources and choose Make Patch. When asked if you want to create a new patch, click the Append button and select ╥Sample 1.3 patch,╙ which you created in step 1. After opening the patch, you will have an opportunity to adjust the patch options.
  205.  
  206. Ñ    Repeat step 2 for the changes from version 1.2 to 1.3. You now have a self╨applying patch that can upgrade versions 1.0, 1.0.1 and 1.2 of Sample to version 1.3.
  207.  
  208. An easy way to do this incrementally is:
  209.  
  210. Ñ    Create a new patch for the first upgrade (1.0 => 1.0.1).
  211.  
  212. Ñ    When the time comes to release the second upgrade, duplicate the patch for the first upgrade, rename it, and append the new patch information to it (1.0.1 => 1.2).
  213.  
  214. Ñ    For each subsequent upgrade, always duplicate and rename the last patch you created, and append your changes to it.
  215.  
  216. One Patch for Many Files
  217. A single patch can also contain the information needed to patch multiple files; for example, an application and its Apple Guide file. Simply compare each additional file and append the patch information, as describe above. The patch options can be set individually for each file you want patched.
  218.  
  219. Adding Notes to the Patch
  220. Open the patch with a resource editor and edit 'TEXT'/'styl' resource 128. This resource contains the patch notes that are displayed when the patch is first opened. You may add any notes here that you like, but at the very least, please add your contact information (phone number, e-mail address, etc.). You would not believe the amount of e-mail I get from people who have questions about some patch that I didn╒t make!
  221.  
  222. Also, if you delete 'TEXT'/'styl' 128, the patch will skip the initial patch info dialog completely and move on to prompting the user for the target file.
  223.  
  224. Translating Patch To A Foreign Language
  225. To make your own localized patch, follow these steps.
  226.  
  227. I. TRANSLATION
  228. Ñ Build a small patch. Use ╥English (US)╙ for the language.
  229. Ñ Duplicate it. Give the duplicate the US English name of your language (ie: ╥Japanese╙).
  230. Ñ Translate the copy. Be sure to set the region code on the 'vers' 1 resource to match your language, and to add ╥<your language> translation by <your name>.╙ to the end of the long string (ie: ╥Japanese translation by Masatsugu Nagata.╙). Of course, you can translate that last sentence.
  231. Ñ Run the localized patch. Make sure everything works and appears ok.
  232.  
  233. II. ENCAPSULATION
  234. Ñ Compare the localized patch to the original. (Hint: You can use ResCompare to do this. :-)
  235. Ñ Open the localized patch in ResEdit. Delete all resources that are not in ResCompare╒s list of differences. In particular, there should be no resources of type BNDL/CNTL/CODE/CREL/DATA/DREL/ICN# (etc.)/SIZE/ZVER/ZAP#/ZIL#/ZIS#/ZAP .
  236. Ñ In ResCompare, choose ╥File: Encapsulate.╙ Check ╥Resource fork only.╙ Open your localized patch.
  237. Ñ Save the encapsulation. Name it ╥[<your language>].rsrc╙ (ie: ╥[Japanese].rsrc╙). This should be the default.
  238.  
  239. III. INSTALLATION
  240. Ñ Open the encapsulation in ResEdit. There should be only a single 'RF  ' resource with and ID of 1000 + your region code. Its name should be your language (ie: 'RF  ' 1014, name=╥Japanese╙).
  241. Ñ Open ResCompare in ResEdit. You may want to make a backup of ResCompare first. Copy the new 'RF╩╩' resource into it. Save.
  242.  
  243. IV. SUBMISSION
  244. Ñ Send the encapsulation file to me. My address is hecht@vnet.net. Receive fame, fortune, and my undying gratitude. That╒s it!
  245.  
  246. Limitations
  247. When making patches, ResCompare is highly dependent on the version numbers stored in the 'vers' 1 resource. If your application doesn╒t have a 'vers' 1 resource, or if it contains the same version number in both the master and update files, or if it is otherwise malformed, spindled, or mutilated, ResCompare will warn you about it. However, ResCompare does allow you to create and append patches whose version numbers are not in strict ascending order. But, it is up to you to test such patches thoroughly, on all intended versions of your application, since this disables version checking.
  248.  
  249. Self╨applying patches work on applications the same way that some viruses do (by modifying their 'CODE' resources). Because of this, some virus detectors may get upset when a patch starts doing its thing. Tell your users (in the patch notes, perhaps) to turn off virus protectors and restart before patching. Because of this limitation, please remember to check your floppies for viruses before distributing a patch on them.
  250.  
  251. The self╨applying patch requires some free space on the volume, and it makes every possible attempt to apply the patch within the space provided. However, I have had some reports of problems patching files on a nearly full floppy. I therefore suggest copying the file to your hard disk before patching.
  252.  
  253. ResCompare sets the patch╒s preferred memory partition to be large enough to accommodate the largest patch data it will encounter. However, be sure to test the patch in a low memory situation, and increase the preferred size if necessary.
  254.  
  255. The ╥Smart-Installed Application╙ feature works quite well, except for one caveat. If your patch adds new resources that are not meant for all variants of your application, those resources get added to all variants of your application anyway. The prototypical example is, you add a new 'CODE' resource, and the patch puts it into your PPC-only variant. Other than the increase in application size, this is usually harmless. Oh well.
  256.  
  257. To contact me
  258. I hope you enjoy ResCompare. If you like it and find it useful, let me hear from you. If you have any suggestions, questions, or bug reports, send me e╨mail at hecht@vnet.net.
  259.  
  260. Cheers!
  261. ╤ Michael Hecht
  262.